export const PROD_ENV = {
	SERVER_URL: 'https://xxx.com/api',
	IS_DEV: false,
}

export const DEV_ENV = {
	SERVER_URL: 'https://xxx.test/api',
	IS_DEV: true,
}

const isDev = process.env.NODE_ENV === 'development' || ['xxx.test'].includes(location.host)

export type EnvKey = keyof typeof PROD_ENV

export function getProcessEnv(key: EnvKey): string | boolean | void {
	if (isDev) {
		if (DEV_ENV[key] !== undefined) {
			return DEV_ENV[key]
		}
		return ''
	}
	if (PROD_ENV[key] !== undefined) {
		return PROD_ENV[key]
	}
}
